﻿using AuSys.Repos;
using AuSys.Test.TestSupport.Fakes;

namespace AuSys.Test.Repos.App.TestSupport
{
    public class MockRepoTree(
        FakeDataContext context
        ): RepoTree<FakeEntity, FakeEntityCache>(context)
    {
        public IQueryable<FakeEntity> PublicFilterRoots()
            => FilterRoots();
        public IQueryable<FakeEntity> PublicFilterChildrenOf(int id)
            => FilterChildrenOf(id);
        public List<int> PublicGetDescendantIdsOf(int id)
            => GetDescendantIdsOf(id);
        public bool PublicHaveAncestorRelation(int ancestor, int descendant)
            => HaveAncestorRelation(ancestor, descendant);
        protected override IQueryable<FakeEntityCache> DbProjectToCache(IQueryable<FakeEntity> source)
            => source.Select(x => new FakeEntityCache(x.Id, x.Name, x.ParentId));
        public void PublicCacheReset()
            => CacheReset();
    }
}
